<template>
	<view class="content" @click.stop="click"
	style="display: flex;flex-direction: row;background-color: #FFF;margin-top: 2rpx;padding: 16rpx 0;position: relative">
		<image :src="row.coverUrl" mode='aspectFill' style="width: 160rpx;height: 160rpx;margin-left: 16rpx;border-radius: 8rpx;"></image>
		<view style="margin-left: 20rpx;width: 520rpx">
			<view style="margin-bottom: 8rpx;display: flex;justify-content: space-between;">
				<text style="font-weight: bold;font-size: 30rpx;">{{row.name}}</text>
				<text style="color: #FA3534;font-size: 24rpx;">营业中</text>
			</view>
			<u-rate :value="4" gutter='1' size='14' allowHalf readonly></u-rate>
			<view style="display: flex;flex-direction: row;align-items: flex-start;">
				<!-- <u-icon name="map" color='#666' size='36rpx'></u-icon> -->
				<text style="margin-left: 8rpx;font-size: 24rpx;">{{row.addr}}</text>
			</view>
		</view>
		<!-- <view class="right" style="position: absolute;right: 22rpx;">
			<view @click.stop="callAction" style="width: 60rpx;height: 60rpx;border-radius: 30rpx;border: 4rpx solid #DD4949;display: flex;flex-direction: row;align-items: center;justify-content: center;">
				<u-icon name="phone" color='#DD4949' size='20'></u-icon>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default{
		components: {},
		props:{
			row: {
				type: Object,
				default: ()=>{}
			},
		},
		data() {
			return {
			}
		},
		onLoad() {
		},
		methods:{
			click(){
				if(this.row.relatedLessee){
					var _this = this
					uni.showModal({
						content: '确认跳转小程序',
						success(res) {
							if(res.confirm){
								if(_this.row.isRobot){
									uni.reLaunch({
										url: '/pages/home/home?CHN=toLessee&lessee='+_this.row.relatedLessee,
									})
								}else{
									wx.navigateToMiniProgram({
										appId: _this.row.relatedLesseeModel.appid,
										path: _this.row.relatedLesseeModel.homePage,
										//develop开发版；trial体验版；release正式版
										envVersion: 'release', 
										success(res) {
										  // 打开成功
										  console.log("跳转小程序成功！",res);
										} 
									})
								}
							}
						}
					})
					
				}else{
					this.$emit('click', this.row)
				}
			},
			callAction(){
				this.$emit('callAction', this.row)
			},
		}
	}
</script>

<style scoped lang="scss">
</style>